{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-07-17T09:52:17.583670Z",
     "start_time": "2025-07-17T09:52:17.568166Z"
    }
   },
   "source": [
    "'''\n",
    "题目 1:温度数据分析\n",
    "气温：[28, 30, 29, 31, 32, 30, 29]\n",
    "计算平均气温、最高气温和最低气温。\n",
    "找出气温超过 30°的天数。\n",
    "'''\n",
    "\n",
    "import numpy as np\n",
    "\n",
    "temperatures = np.array([28, 30, 29, 31, 32, 30, 29])\n",
    "\n",
    "print(np.max(temperatures))\n",
    "print(np.min(temperatures))\n",
    "print(np.mean(temperatures))\n",
    "\n",
    "print(len(temperatures[temperatures > 30]))\n",
    "print(np.cumsum(temperatures > 30)[-1])\n",
    "print(np.count_nonzero(temperatures > 30))"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "32\n",
      "28\n",
      "29.857142857142858\n",
      "2\n",
      "2\n",
      "2\n"
     ]
    }
   ],
   "execution_count": 16
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "\n",
    "\n"
   ],
   "id": "64c6b208f7cd5953"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-07-17T09:57:53.591727Z",
     "start_time": "2025-07-17T09:57:53.576619Z"
    }
   },
   "cell_type": "code",
   "source": [
    "'''\n",
    "题目 2:学生成绩统计某班级 5 名学生的数学成绩为[85，90，78，92，88]。\n",
    "计算成绩的平均分、中位数和标准差。\n",
    "将成绩转换(假设满分为 10)\n",
    "'''\n",
    "scores = np.array([85, 90, 78, 92, 88])\n",
    "\n",
    "print(np.mean(scores))\n",
    "print(np.median(scores))\n",
    "print(np.std(scores))\n",
    "print('%.3f'%np.std(scores))\n",
    "\n",
    "print(scores / 10)"
   ],
   "id": "eda6bb7eb5ab4b53",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "86.6\n",
      "88.0\n",
      "4.882622246293481\n",
      "4.883\n",
      "[8.5 9.  7.8 9.2 8.8]\n"
     ]
    }
   ],
   "execution_count": 21
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
